package com.xishu.entity.foodpanda;

import com.xishu.annotation.dao.FieldMapping;
import com.xishu.annotation.lang.Lang;
import com.xishu.annotation.sort.ShowOrder;
import com.xishu.entity.AbstractEntity;
import com.xishu.entity.NameAndId;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.Entity;
import javax.persistence.Index;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.ArrayList;
import java.util.List;

@Entity(name = "category")
@Table(indexes = {@Index(columnList = "shopId")})
@Data
public class Category extends AbstractEntity {
    private static final long serialVersionUID = -1148287680473300416L;

    @ApiModelProperty(value = "归属的餐厅公司")
    private Long companyId;

    @ApiModelProperty(value = "分店的ID")
    private Long shopId;

    @ApiModelProperty(value = "标题名称")
    @Lang(key = "name")
    private String name;

    @Lang(key = "name")
    @ApiModelProperty(value = "标题名称-中文")
    private String name_zh;

    @Lang(key = "name")
    @ApiModelProperty(value = "标题名称-英文")
    private String name_en;

    @ApiModelProperty(value = "排序")
    @ShowOrder
    private Integer showOrder;

    @Transient
    @ApiModelProperty(value = "适用的场景")
    @FieldMapping(desField = "sceneJson", serialize = true)
    private List<NameAndId> sceneList = new ArrayList<>();

    @ApiModelProperty(value = "适用的场景")
    @FieldMapping(desField = "sceneList", serialize = false, genericType = "com.xishu.entity.NameAndId")
    private String sceneJson;

    @ApiModelProperty(value = "描述")
    @Lang(key = "description", lang = "")
    private String description;

    @ApiModelProperty(value = "描述中文")
    @Lang(key = "description", lang = "zh")
    private String description_zh;

    @ApiModelProperty(value = "描述英文")
    @Lang(key = "description", lang = "en")
    private String description_en;

}
